package com.starsoft.trade.web;

import java.util.List;
import java.util.Map;

import javax.servlet.ServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.starsoft.frame.base.service.UserService;
import com.starsoft.trade.bean.TradeFee;
import com.starsoft.trade.service.TradeFeeService;

@RestController
@RequestMapping(value = "/trade/set")
public class TradeFeeController {

	@Autowired
	private TradeFeeService service;
	
	@RequestMapping(value = "/feeQuery")
	public List<TradeFee> query(ServletRequest request) throws Exception {
		Integer acountId = UserService.getUserContext().getAcountId();
		return service.getAll(acountId);
	}

	@RequestMapping(value = "/feeSave")
	public Map<String, Object> save(TradeFee fee) {
		service.save(fee);
		return null;
	}
	
	@RequestMapping(value = "/copy")
	public List<TradeFee> copy(ServletRequest request) {
		Integer acountId = UserService.getUserContext().getAcountId();
		return service.deleteAndCopy(1, acountId);
	}
	
}
